/*
 *  添加用户界面
 */
var util = require('../../utils/util.js');
var app = getApp();
Page({
  data: {
    dialog5: {
      hidden: true
    },
    upload: { hidden: true },
    moeny: "待支付",
    ynumber: "",
  },
  onLoad: function (option) {
    var that = this;
    that.setData({ 'dialog5.hidden': false });
    var ynumberwww = option.ynumber
    var that = this;
    var phone = ynumberwww;
    try {
      wx.request({
       // url: 'http://localhost:8080/ssm/owner/newselectPhone',
        url: 'https://wwl.ycws.cc/ssm/owner/newselectPhone',

        data: {
          yphone: phone
        },
        method: "POST",
        header: { 'content-type': 'application/x-www-form-urlencoded' },
        success: function (res) {
          //console.log("---------" + res.data);
          /*if (res.data.newowner == null) {
            wx.request({
              url: 'https://wwl.ycws.cc/ssm/owner/selectOnePhone',
              data: {
                yphone: phone
              },
              header: {
                'content-type': 'application/json'
              },
              success: function (res) {
                console.log(res.data)
                console.log(res.data.uploadfiles[0].ynumber)
                app.owner.ynumber = res.data.uploadfiles[0].ynumber;
                wx.redirectTo({
                  url: '../../pages/adduser/adduser'
                })
              }
            })
          } else {*/
          that.setData({ 'dialog5.hidden': true });
          if (res.data == undefined) {//判断是否返回出现异常

            that.setData({
              upload: {
                hidden: false
              }
            });
          } else {
            that.setData({ list: res.data.newowner.uploadfiles });
            console.log(res.data);
            app.ynumber = res.data.newowner.ynumber;
            app.owner.ynumber = res.data.newowner.ynumber;
            //}

          }
        },
        fail: function (res) {
          that.setData({ 'dialog5.hidden': true });
          that.setData({
            upload: {
              hidden: false
            }
          });
          console.log("没有数据");
        }
      })
    　　} catch (error) {
      that.setData({
        upload: {
          hidden: false
        }
      });
    }
    
  },
 uploadChange: function (e) {
    this.setData({
      upload: {
        hidden: true
      }
    });
  },
  shenghe: function () {
    util.msg("提示", "请前往管理处审核");
  },
  update: function () {
    wx.redirectTo({
      url: '../showuser/showuser'
    })
  },
  exit: function () {
    util.indexk("提示", "确定退出吗？");
  },
  adduser: function () {
    var phoneto="";
    wx.navigateTo({
      url: '../adduser/adduser?phoneto=' + phoneto
    })
  }
})